<?php 
$_thumbnail = 'img/blueprint.png';
$_action = 'add';
$_type_id = tos_http_get('type_id');

if($this->has_data('thumbnail')) {
    $_thumbnail = $this->get_data('thumbnail');
}
if ($this->has_data('action')) {
    $_action = $this->get_data('action');
}
if ($this->has_data('type_id')) {
    $_type_id = $this->get_data('type_id');
}
$_types = $this->get_data('types');
$_type_id = tos_http_get('type_id');
?>
<div id="ne_w">
<div id="pne"></div>
<div id="dashboard">
<h1 class="caption"><?php $this->write('page_caption')?></h1>
<div class="search_box">
    <form accept-charset="utf-8" action="<?php echo tos_url();?>" method="get">
        <input type="text" class="text" name="q" value="<?php echo tos_http_get('q');?>" />
        <select name="type_id">
            <option value=""></option>
            <?php foreach ($_types as $t):?>
                <option value="<?php echo $t['id'];?>" <?php if ($_type_id == $t['id']) echo 'selected="selected"'; ?>><?php echo $t['name'];?></option>
            <?php endforeach;?>
        </select>
        <input type="submit" class="submit" value="search" />
    </form>
</div>
<div class="box">
<div class="nl">
    <?php foreach ($this->get_data('nodes') as $node): ?>
    <div class="n">
        <?php if ($node['thumbnail']):?>
            <div class="thum"><?php echo tos_img($node['thumbnail'], 60, 60);?></div>
        <?php endif;?>
        <h2 class="caption item">
        <a href="<?php echo tos_url(array('m' => 'node', 'a' => 'display', 'node_id' => $node['id']));?>"><?php echo $node['caption']; ?></a> 
        </h2>
        <div class="keywords item"><?php echo $node['keywords']; ?></div>
        <div class="description item"><?php echo $node['description']; ?></div>
        <div class="action item">
            <ul class="inline-block">
                <li class="action"><a href="<?php echo tos_url(array('m' => 'node', 'a' => 'edit', 'node_id' => $node['id']));?>">Edit</a></li>
                <li class="action"><a href="<?php echo tos_url(array('m' => 'node', 'a' => 'display', 'node_id' => $node['id']));?>">Detail</a></li>
                <li class="action"><?php m('node')->block_add_options(tos_url(array('m'=>'node', 'a'=>'add', 'parent_id'=>$node['id'])))->display('html');?></li>
            </ul>
        </div>
        <div class="clear"></div>
    </div>
    <?php endforeach; ?>
</div>
<?php $this->display_box();?>
</div>
</div>
</div>